#Include "Protheus.ch"

#Define MARGEM_ESQ   0050
#Define MARGEM_DIR   0050
#Define MARGEM_INF   0050
#Define MARGEM_SUP   0050
#Define ALTURA       3508
#Define LARGURA      2480
#Define ALTURA_MAX   ALTURA - (MARGEM_INF * 2)
#Define LARGURA_MAX  LARGURA - (MARGEM_DIR * 2)
#define DMPAPER_A4   9 // A4 210 x 297 mm

User Function RelPed()

Local aMargens   := {MARGEM_ESQ, MARGEM_DIR, MARGEM_INF, MARGEM_SUP}
Local cTitulo    := "Pedidos de Venda"

Private nLin     := MARGEM_SUP
Private nAltura  := ALTURA_MAX
Private nLargura := LARGURA_MAX
Private nColIni  := MARGEM_ESQ
Private nLinIni  := MARGEM_SUP
Private oPrint   := Nil

oPrint := TMSPrinter():New(cTitulo)

oPrint:SetPortrait()
oPrint:SetPaperSize(DMPAPER_A4)
oPrint:Setup()

oPrint:StartPage()

	Cabec()

oPrint:EndPage()
oPrint:Preview()

Return Nil

// ------------------------------------------------------------------------------------ //

Static Function Cabec()

IF nLargura < nLin
	oPrint:EndPage()
	oPrint:StartPage()
EndIF

oPrint:nPageHeight := 3508
oPrint:nPageWidth  := 2480

oPrint:Box(nLinIni, nColIni, 400, nLargura)
oPrint:Say(nLinIni + 10, nColIni, cValTochar(oPrint:nPageHeight))
oPrint:Say(nLinIni + 50, nColIni, cValTochar(oPrint:nPageWidth))

Return

// ------------------------------------------------------------------------------------ //

//Static Function Rodape()
//Return Nil